<!doctype html>
<script src = "/resources/testharness.js"></script>
<script src = "/resources/testharnessreport.js"></script>
<script>
let test = async_test('CSP should be enforced to the iframe');
let counter = 0;
const global = window;

function check() {
  ++counter;
  if (counter !== 2)
    return;
  const iframe = document.querySelector('iframe');
  assert_true(global.script_loaded, 'in the main frame');
  assert_equals(iframe.contentWindow.script_loaded, undefined, 'in the iframe');
  test.done();
}
</script>

<script src="http://localhost:8000/security/contentSecurityPolicy/resources/redirect.pl?type=script&wait=true" async onload="test.step(check)"></script>
<iframe src="resources/redirect-with-delay-iframe.html" onload="test.step(check)"></iframe>
